/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.fl.entity;

import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 评价明细表Entity
 * @author anthony
 * @version 2019-01-08
 */
@Table(name="fl_evaluate_detail", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="appointment_id", attrName="appointment.id", label="预约id"),
		@Column(name="source", attrName="source", label="评价来源", comment="评价来源：1客户2客服"),
		@Column(name="content", attrName="content", label="content"),
		@Column(name="read_flag", attrName="readFlag", label="是否看过"),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class EvaluateDetail extends DataEntity<EvaluateDetail> {
	
	private static final long serialVersionUID = 1L;
	private Appointment appointment;		// 预约
	private String source;		// 评价来源：1客户2客服
	private String content;		// content
	private String readFlag;		//是否看过：1为看过，0没有看过
	
	public EvaluateDetail() {
		this(null);
	}

	public EvaluateDetail(Appointment appointment){
		this.appointment = appointment;
	}

	@NotBlank(message="评价来源不能为空")
	@Length(min=0, max=3, message="评价来源长度不能超过 3 个字符")
	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}
	
	@NotBlank(message="content不能为空")
	@Length(min=0, max=255, message="content长度不能超过 255 个字符")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}
	
	public String getSource_gte() {
		return sqlMap.getWhere().getValue("source", QueryType.GTE);
	}

	public void setSource_gte(String source) {
		sqlMap.getWhere().and("source", QueryType.GTE, source);
	}
	
	public String getSource_lte() {
		return sqlMap.getWhere().getValue("source", QueryType.LTE);
	}

	public void setSource_lte(String source) {
		sqlMap.getWhere().and("source", QueryType.LTE, source);
	}

	public Appointment getAppointment() {
		return appointment;
	}

	public void setAppointment(Appointment appointment) {
		this.appointment = appointment;
	}

	public String getReadFlag() {
		return readFlag;
	}

	public void setReadFlag(String readFlag) {
		this.readFlag = readFlag;
	}
}